﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace CourseScheduling
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.IsAuthenticated)
            {
                if (Roles.IsUserInRole("admin"))
                {
                    var item = new MenuItem();
                    item.Text = "Accounts";
                    item.NavigateUrl = "~/Roles/ManageRoles.aspx";
                    NavigationMenu.Items.AddAt(1, item);
                }


                if (Roles.IsUserInRole("admin") ||
                    Roles.IsUserInRole("Advisor"))
                {
                    var item = new MenuItem();
                    item.Text = "Edit Catalog";
                    item.NavigateUrl = "~/EditCatalog.aspx";
                    NavigationMenu.Items.AddAt(1, item);

                    item = new MenuItem();
                    item.Text = "Reports";
                    item.NavigateUrl = "~/Reports.aspx";
                    NavigationMenu.Items.AddAt(1, item);
                }

                if (Roles.IsUserInRole("Instructor"))
                {
                    var item = new MenuItem();
                    item.Text = "Course Preferences";
                    item.NavigateUrl = "~/CoursePreferences.aspx";
                    NavigationMenu.Items.AddAt(1, item);
                }
            }
        }
    }
}
